/*
 * @PageName:
 * @Description:
 * @FilePath: /glm-mes-pc/src/api/inspectionInfo.js
 */
import request from '@/utils/request'

/* ------------ 检品接单 ------------ */
// 列表
export function getPredictionInspectionListAPI(data) {
	return request({
		url: '/glm/prediction/inspectionList',
		method: 'post',
		headers: { repeatSubmit: false },
		data
	})
}
// 筛选接口
export function getInspectionListAPI(params, data) {
	return request({
		url: '/glm/prediction/distinctInspectionList',
		method: 'post',
		params,
		data
	})
}

// 批量接单
export function receiveInspectionOrderAPI(data) {
	return request({
		url: '/glm/prediction/receiveInspectionOrder',
		method: 'post',
		data
	})
}
// 根据销售订单款号查询
export function getPurchaseNumberAPI(data) {
	return request({
		url: '/glm/inspection/getPurchaseNumber',
		method: 'post',
		data
	})
}

/* ------------ 目的港 ------------ */
// 保存
export function saveAdressByOrderAPI(data) {
	return request({
		url: '/glm/inspection/saveAdressByOrder',
		method: 'post',
		data
	})
}

// 查询
export function getAdressByOrderAPI(params) {
	return request({
		url: '/glm/inspection/getAdressByOrder',
		method: 'post',
		params
	})
}

// 编辑更新地址
export function updateAdressByOrderAPI(data) {
	return request({
		url: '/glm/inspection/updateAdressByOrder',
		method: 'post',
		data
	})
}


/* ------------ 抽检、上线单检 ------------ */
// 列表
export function inspectListAPI(data) {
	return request({
		url: '/glm/inspection/inspectList',
		method: 'post',
		data
	})
}

// 表格筛选查询
export function inspectListDistinctAPI(params, data) {
	return request({
		url: '/glm/inspection/inspectListDistinct',
		method: 'post',
		params,
		data
	})
}
// 抽检合格或不合格
export function inspectYesOrNoAPI(data) {
	return request({
		url: '/glm/inspection/inspectYesOrNo',
		method: 'post',
		data
	})
}
// 获取报告书上左数据
export function getReportParamsAPI(data) {
	return request({
		url: '/glm/inspection/getReportParams',
		method: 'post',
		data
	})
}
// 提交报告书
export function doInspectionReportAPI(data) {
	return request({
		url: '/glm/inspection/doInspectionReport',
		method: 'post',
		data
	})
}
// 查看报告书
export function getInspectionReportAPI(inspectNum) {
	return request({
		url: '/glm/inspection/getInspectionReport?inspectNum=' + inspectNum,
		method: 'post'
	})
}

/* ------------ 生成箱单 ------------ */
// 查询
export function inspectionListByBoxAPI(data) {
	return request({
		url: '/glm/prediction/inspectionListByBox',
		method: 'post',
		data
	})
}

// 获取款式每箱可以装的数量
export function getBoxNumAPI(params) {
	return request({
		url: '/glm/inspection/getBoxQuantity',
		method: 'post',
		params
	})
}
// 箱单详情
export function getPackingListDetails(data) {
	return request({
		url: '/glm/inspection/getPackingListDetails',
		method: 'post',
		data
	})
}
// 箱单模板二
export function getPackingListDetailsTwo(data) {
	return request({
		url: '/glm/inspection/getPackingListDetailsTwo',
		method: 'post',
		data
	})
}

export function inspectionDelivery(data) {
	return request({
		url: '/glm/inspection/inspectionDelivery',
		method: 'post',
		data
	})
}

// 手动装箱：根据销售订单查寻款号/sku详情
export function getSkuByRecords(data) {
	return request({
		url: '/glm/inspection/getSkuByRecords',
		method: 'post',
		data
	})
}

// 完成手动装箱
export function manualForBox(data) {
	return request({
		url: '/glm/inspection/manualForBox',
		method: 'post',
		data
	})
}

// 手动装箱时保存箱数和总数量
export function saveBoxByOrder(data) {
	return request({
		url: '/glm/inspection/saveBoxByOrder',
		method: 'post',
		data
	})
}


/* ------------ 外协工厂 ------------ */
// 外协工厂检验单列表
export function getFactoryList(data) {
	return request({
		url: '/glm/inspection/factoryList',
		headers: { repeatSubmit: false },
		method: 'post',
		data
	})
}
// 外协工厂筛选接口
export function getFactoryListDistinctList(params, data) {
	return request({
		url: '/glm/inspection/factoryListDistinct',
		method: 'post',
		params,
		data
	})
}
// 重检
export function retest(data) {
	return request({
		url: '/glm/inspection/retest',
		method: 'post',
		data
	})
}

// 不合格查看原因
export function getReason(inspectNum) {
	return request({
		url: '/glm/inspection/getReason',
		method: 'post',
		params: {
			inspectNum
		}
	})
}

// 关闭
export function closeRecord(data) {
	return request({
		url: '/glm/inspection/closeRecord',
		method: 'post',
		data
	})
}
